# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1063.1.4 -> 1.1063.1.5 # drivers/char/serial.c 1.39 -> 1.40 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/08/07 bjorn.helgaas@hp.com 1.1063.1.5 # SERIAL_ACPI: minor reorganization to follow 2.6. # -------------------------------------------- # diff -Nru a/drivers/char/serial.c b/drivers/char/serial.c --- a/drivers/char/serial.c Wed Oct 8 09:06:03 2003 +++ b/drivers/char/serial.c Wed Oct 8 09:06:03 2003 @@ -4664,46 +4664,60 @@ } #ifdef ENABLE_SERIAL_ACPI -static acpi_status acpi_serial_resource(struct acpi_resource *resource, void *data) +static acpi_status acpi_serial_address(struct serial_struct *req, + struct acpi_resource_address64 *addr) +{ + unsigned long size; + + size = addr->max_address_range - addr->min_address_range + 1; + req->iomem_base = ioremap(addr->min_address_range, size); + if (!req->iomem_base) { + printk("%s: couldn't ioremap 0x%lx-0x%lx\n", __FUNCTION__, + addr->min_address_range, addr->max_address_range); + return AE_ERROR; + } + req->io_type = SERIAL_IO_MEM; + return AE_OK; +} + +static acpi_status acpi_serial_irq(struct serial_struct *req, + struct acpi_resource_ext_irq *ext_irq) +{ + if (ext_irq->number_of_interrupts > 0) { +#ifdef CONFIG_IA64 + req->irq = acpi_register_irq(ext_irq->interrupts[0], + ext_irq->active_high_low, ext_irq->edge_level); +#else + req->irq = ext_irq->interrupts[0]; +#endif + } + return AE_OK; +} + +static acpi_status acpi_serial_resource(struct acpi_resource *res, void *data) { struct serial_struct *serial_req = (struct serial_struct *) data; struct acpi_resource_address64 addr; acpi_status status; - status = acpi_resource_to_address64(resource, &addr); - if (ACPI_SUCCESS(status)) { - serial_req->iomem_base = ioremap(addr.min_address_range, - addr.max_address_range - addr.min_address_range + 1); - if (!serial_req->iomem_base) { - printk("%s: couldn't ioremap 0x%lx-0x%lx\n", - __FUNCTION__, addr.min_address_range, - addr.max_address_range); - return AE_ERROR; - } - serial_req->io_type = SERIAL_IO_MEM; - serial_req->port = 0; - serial_req->port_high = 0; - } else if (resource->id == ACPI_RSTYPE_EXT_IRQ) { - struct acpi_resource_ext_irq *ext_irq = &resource->data.extended_irq; - if (ext_irq->number_of_interrupts > 0) { - serial_req->irq = acpi_register_irq(ext_irq->interrupts[0], - ext_irq->active_high_low, ext_irq->edge_level); - } - } - + status = acpi_resource_to_address64(res, &addr); + if (ACPI_SUCCESS(status)) + return acpi_serial_address(serial_req, &addr); + else if (res->id == ACPI_RSTYPE_EXT_IRQ) + return acpi_serial_irq(serial_req, &res->data.extended_irq); return AE_OK; } static int acpi_serial_add(struct acpi_device *device) { - struct serial_struct serial_req; acpi_status status; + struct serial_struct serial_req; int line; memset(&serial_req, 0, sizeof(serial_req)); status = acpi_walk_resources(device->handle, METHOD_NAME__CRS, - acpi_serial_resource, &serial_req); + acpi_serial_resource, &serial_req); if (ACPI_FAILURE(status)) return -ENODEV; @@ -4732,18 +4746,15 @@ } static struct acpi_driver acpi_serial_driver = { - name: "serial", - class: "", - ids: "PNP0501", - ops: { - add: acpi_serial_add, - remove: acpi_serial_remove, - }, + .name = "serial", + .class = "", + .ids = "PNP0501", + .ops = { + .add = acpi_serial_add, + .remove = acpi_serial_remove, + }, }; -/* - * Look for serial ports in the ACPI namespace. - */ static void __devinit probe_serial_acpi(void) { acpi_bus_register_driver(&acpi_serial_driver);